<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Bootstrap core CSS -->
<link href="/admin/public/bootstrap.min.css" title="" rel="stylesheet" />
<link href="/admin/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
	<script src="/admin/public/html5shiv.min.js"></script>
	<script src="/admin/public/respond.min.js"></script>
<![endif]-->
<!-- Gritter -->
<link href="/admin/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
<!-- Animation CSS -->
<link rel="stylesheet" href="/admin/css/login.css" />
<link rel="stylesheet" type="text/css" href="/admin/css/xcConfirm.css"/>
<title>伴你健身微信约课系统</title>
<style>
	    		body{
	    			overflow:hidden;
	    		}
	    		.row{
	    			margin-left:0;
	    			margin-right:0;
	    		}
	    	</style>
</head>
<body>
			<div class="row">
			<div id="login_page" class="row col-lg-12">
				<h1><strong>伴你健身微信约课系统</strong></h1>
				<form id="login" class="col-lg-2 col-md-2 col-sm-2 ">
					<input type="text" class="form-control" name="userName" style="width:280px;" id="userName" placeholder="请输入用户名">
					<input style="margin:15px 0;width:280px;" type="password"  class="form-control" name="userPwd" placeholder="请输入密码" />
					<button type="button" onclick="btnClick();" class="btn btn-primary">登录</button>
				</form>
					</div>
				<span>  技术支持：鹏翔科技</span>
			</div>
		</div>
		<script src="public/jquery-1.11.3.js"></script>
		<script src="/admin/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
	$(function(){
		$("#userName").focus();
	})
	$("body").keydown(function(event){
		var code = event.keyCode;
		if(code==13){//回车
			btnClick(); //调用btnClick函数
		}
	});
 
		function btnClick(){
			$.ajax({
				type:"post",
				data:$("#login").serialize(),
				url:"login/userLogin",
				success:function(data){
					if(data.isLogin){
		        		location.href='/admin/index';
		    		}else{
		    			var txt= data.message;
		                 window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error,{onOk:function(){
		                	 //window.location.href = window.location.href;
		                	 //刷新页面的方式
		                	 window.location.reload();
		      		 	 }});
		               
		    			//$("input[name='userPwd'],input[name='code']").val("");	
		    		}
				},
				error:function(data){
					
				}
			})
		}
	</script>
</body>
</html>